package cn.wolfcode.article;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @PostMapping("/add")
    public Long add(Long id){
        Long increment = redisTemplate.opsForValue().increment("article_:" + id.toString());
        return increment;
    }
}
